package com.gko100.action.front;


import java.sql.Timestamp;
import java.util.ArrayList;

import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
import java.util.Map;

import com.gko100.action.base.AdminBaseAction;
import com.gko100.model.Article;
import com.gko100.model.Disease;
import com.gko100.model.Image;
import com.gko100.model.Language;
import com.gko100.model.Message;
import com.gko100.model.Navigation;
import com.gko100.util.DateTimeUtil;
import com.gko100.vo.DiseArti;
import com.gko100.vo.Doctor;
import com.gko100.vo.Institution;
import com.gko100.vo.MessageVo;
import com.gko100.vo.NavigationVo;
import com.gko100.vo.NewsArti;
import com.gko100.vo.FriendLink;
import com.gko100.vo.TopFlashVo;
import com.opensymphony.xwork2.ActionContext;

public class LangAction extends AdminBaseAction {
	
	private String sortParam;
	public String getSortParam() {
		return sortParam;
	}
	public void setSortParam(String sortParam) {
		this.sortParam = sortParam;
	}
	
	private String param_navId;
	
	public String getParam_navId() {
		return param_navId;
	}
	public void setParam_navId(String paramNavId) {
		param_navId = paramNavId;
	}

	//语言对象
	private Language lang;
	public Language getLang() {
		return lang;
	}
	public void setLang(Language lang) {
		this.lang = lang;
	}
	
	//导航分类对象
	private Navigation nav;
	
	public Navigation getNav() {
		return nav;
	}
	public void setNav(Navigation nav) {
		this.nav = nav;
	}

	//导航列表Map存储名值对，值为list
	
	private List<Navigation> navList;
	
	public List<Navigation> getNavList() {
		return navList;
	}
	public void setNavList(List<Navigation> navList) {
		this.navList = navList;
	}

	//语言切换
	public String change_lang() throws Exception {
		
		if(this.getLang()!=null&&this.getLang().getLangName()!=null){
			
			String langName = this.getLang().getLangName();
			
			if(langName.equals("zh_CN")){
				
				Locale newLocale = new Locale("zh","CN");
				Locale.setDefault(newLocale);
				
			}else if(langName.equals("en_US")){
				
				Locale newLocale = new Locale("en","US");
				Locale.setDefault(newLocale);
	
			}else{
				
				Locale newLocale = new Locale("zh","CN");
				Locale.setDefault(newLocale);	
			}
			this.setLang(null);
		}

		return "lang_change_success";
	}
	
	
	/**
	 *  -------------------前台---顶部动画模块-----------
	 */
	//顶部动画Vo对象
	
	private TopFlashVo tfVo;
	private List<TopFlashVo> tfVoList;
	
	public TopFlashVo getTfVo() {
		return tfVo;
	}
	public void setTfVo(TopFlashVo tfVo) {
		this.tfVo = tfVo;
	}
	public List<TopFlashVo> getTfVoList() {
		return tfVoList;
	}
	public void setTfVoList(List<TopFlashVo> tfVoList) {
		this.tfVoList = tfVoList;
	}
	public String find_topFlash() throws Exception{
		
		if(this.getNav()!=null){
			this.setNav(null);
		}
		if(this.getTfVoList()!=null){
			this.setTfVoList(null);
		}
		String navNote=null;
		
		if(Locale.getDefault().equals(Locale.CHINA)){

			navNote = "tf_cn";
			
		}else if(Locale.getDefault().equals(Locale.US)){

			navNote = "tf_en";
		}
		Navigation nav = adminManager.findNavByNavNote(navNote);
		if(nav!=null){
			
			this.setNav(nav);
			
			List<Article> artiList = adminManager.findArtiListByNav(nav);
			
			if(artiList!=null&&artiList.size()>=1){
				
				List<TopFlashVo> tfvl = new ArrayList<TopFlashVo>();
				for(int i=0;i<artiList.size();i++){
					
					Article arti = artiList.get(i);
					TopFlashVo tfv = new TopFlashVo();
					if(arti!=null){
						
						tfv.setId(arti.getArtiId());
						tfv.setTitle(arti.getArtiTitle());
						tfv.setTfvUrl(arti.getUrl());
						tfv.setSummary(arti.getArtiSumm());
						List<Image> imageList = adminManager.findImageByArti(arti);
						if(imageList!=null&&imageList.size()>=1){
							Image image = imageList.get(0);
							tfv.setImageSrc(image.getImgSrcName()+image.getImgSaveName());
						}
						tfvl.add(tfv);
					}
				}
				if(tfvl!=null){
					this.setTfVoList(tfvl);
				}
				tfvl = null;
			}	
		}
		return "topFlash_find_success";
	}
	
	//查找所有导航分类
	
	public List<Navigation> cycleNavList(Navigation nav){

		if(nav!=null){
			List<Navigation> navList = adminManager.findNavListByNavPId(nav.getNavId());
			if(navList!=null&&navList.size()>=1){
				for(int i=0;i<navList.size();i++){
					List<Navigation> nl = this.cycleNavList(navList.get(i));
					if(nl!=null&&nl.size()>=1){
						navList.addAll(nl);
					}
				}
			}
			if(navList!=null&&navList.size()>=1){
				return navList;
			}
		}		
		return null;
	}
	
	
	/**
	 * 导航列表
	 * 导航Vo对象
	 */

	private Map<NavigationVo, List<Navigation>> navVoMap;
	
	public Map<NavigationVo, List<Navigation>> getNavVoMap() {
		return navVoMap;
	}
	public void setNavVoMap(Map<NavigationVo, List<Navigation>> navVoMap) {
		this.navVoMap = navVoMap;
	}
	
	public String find_navList() throws Exception {
		
		
		if(this.getNavVoMap()!=null){
			this.setNavVoMap(null);
		}

		String[] navNoteList = {"hp", "ms", "ts", "ta", "ik", "so", "sc", "ju", "au"};
		if(Locale.getDefault().equals(Locale.CHINA)){
			
			Map<NavigationVo, List<Navigation>> nvMap = new LinkedHashMap<NavigationVo, List<Navigation>>();
			
			for(int i=0; i<navNoteList.length; i++){
				
				Navigation n = adminManager.findNavByNavNote(navNoteList[i]+"_cn");
				if(n!=null){
					NavigationVo nVo = new NavigationVo();
					nVo.setId(n.getNavId());
					nVo.setName(n.getNavName());
					nVo.setUrl(n.getNavUrl());
					nVo.setNote(n.getNavNote());
					Image image = n.getImage();
					if(image!=null){
						
						nVo.setImageSrc(image.getImgSrcName()+image.getImgSaveName());
						
					}
					List<Navigation> nList = adminManager.findNavListByNavPId(n.getNavId());
					if(nList!=null){
						nvMap.put(nVo, nList);
					}else{
						nvMap.put(nVo, null);
					}
				}
				
			}
			if(nvMap!=null){
				this.setNavVoMap(nvMap);
				nvMap = null;
			}
			navNoteList = null;
			

		} else if(Locale.getDefault().equals(Locale.US)){
			Map<NavigationVo, List<Navigation>> nvMap = new LinkedHashMap<NavigationVo, List<Navigation>>();
			for(int i=0; i<navNoteList.length; i++){
				
				Navigation n = adminManager.findNavByNavNote(navNoteList[i]+"_en");
				if(n!=null){
					NavigationVo nVo = new NavigationVo();
					nVo.setId(n.getNavId());
					nVo.setName(n.getNavName());
					nVo.setUrl(n.getNavUrl());
					nVo.setNote(n.getNavNote());
					Image image = n.getImage();
					if(image!=null){
						
						nVo.setImageSrc(image.getImgSrcName()+image.getImgSaveName());
						
					}
					List<Navigation> nList = adminManager.findNavListByNavPId(n.getNavId());
					if(nList!=null){
						nvMap.put(nVo, nList);
					}else{
						nvMap.put(nVo, null);
					}
				}
			}
			if(nvMap!=null){
				this.setNavVoMap(nvMap);
				nvMap = null;
			}
			navNoteList = null;
			
		}

		return "navList_find_success";
	}
	
	/**
	 * -------------前台---------------医疗机构模块----------
	 */
	
	//vo对象---医疗机构
	private Institution inst;
	private List<Institution> instList;
	
	public Institution getInst() {
		return inst;
	}
	public void setInst(Institution inst) {
		this.inst = inst;
	}
	public List<Institution> getInstList() {
		return instList;
	}
	public void setInstList(List<Institution> instList) {
		this.instList = instList;
	}
	public String find_instList() throws Exception {
		
		if(this.getNav()!=null){
			this.setNav(null);
		}
		if(this.getInstList()!=null){
			this.setInstList(null);
		}
		String navNote=null;

		if(Locale.getDefault().equals(Locale.CHINA)){
			
			navNote = "inst_cn";
			
		}else if(Locale.getDefault().equals(Locale.US)){

			navNote = "inst_en";
		}
		Navigation nav = adminManager.findNavByNavNote(navNote);
		if(nav!=null){
			
			this.setNav(nav);
			if(this.getSortParam()!=null){
				
				List<Article> artiList = adminManager.findArtiListByNavAndSortParam(nav, this.getSortParam());
				if(artiList!=null&&artiList.size()>=1){
					
					List<Institution> instList = new ArrayList<Institution>();
					for(int i=0;i<artiList.size();i++){
						
						Article arti = artiList.get(i);
						if(arti!=null){
							
							Institution inst = new Institution();
							inst.setInstId(arti.getArtiId());
							inst.setTitle(arti.getArtiTitle());
							inst.setUrl(arti.getUrl());
							inst.setSummary(arti.getArtiSumm());
							List<Image> imageList = adminManager.findImageByArti(arti);
							if(imageList!=null&&imageList.size()>=1){
								Image image = imageList.get(0);
								if(image!=null){
									
									inst.setImgSrcName(image.getImgSrcName()+image.getImgSaveName());
								}
							}
							instList.add(inst);
						}

					}
					if(instList!=null){
						this.setInstList(instList);
						instList = null;
					}	
				}
			}
		}

		return "instList_find_success";
	}
	
	
	//vo对象--名医专家
	private Doctor doct;
	private List<Doctor> doctList;

	public Doctor getDoct() {
		return doct;
	}
	public void setDoct(Doctor doct) {
		this.doct = doct;
	}
	public List<Doctor> getDoctList() {
		return doctList;
	}
	public void setDoctList(List<Doctor> doctList) {
		this.doctList = doctList;
	}
	public String find_doctList() throws Exception {
		
		if(this.getNav()!=null){
			this.setNav(null);
		}
		if(this.getDoctList()!=null){
			this.setDoctList(null);
		}
		String navNote=null;

		if(Locale.getDefault().equals(Locale.CHINA)){
		
			navNote = "doct_cn";
			
		}else if(Locale.getDefault().equals(Locale.US)){

			navNote = "doct_en";
		}
		Navigation nav = adminManager.findNavByNavNote(navNote);
		if(nav!=null){
			
			this.setNav(nav);
			if(this.getSortParam()!=null){

				List<Article> artiList = adminManager.findArtiListByNavAndSortParam(nav, this.getSortParam());
				if(artiList!=null&&artiList.size()>=1){
					
					List<Doctor> doctList = new ArrayList<Doctor>();
					for(int i=0;i<artiList.size();i++){
						
						Article arti = artiList.get(i);
						if(arti!=null){
							
							Doctor doct = new Doctor();
							doct.setDoctId(arti.getArtiId());
							doct.setName(arti.getArtiTitle());
							
							
							List<Image> imageList = adminManager.findImageByArti(arti);
							if(imageList!=null&&imageList.size()>=1){
								Image image = imageList.get(0);
								if(image!=null){
									
									doct.setImgSrcName(image.getImgSrcName()+image.getImgSaveName());
								}
							}
							doctList.add(doct);
						}

					}
					if(doctList!=null){
						this.setDoctList(doctList);
						doctList = null;
					}
					
				}
				this.setSortParam(null);
			}
		}
		return "doctList_find_success";
	}

	//前台行业知识----新闻报道vo对象
	
	private List<NewsArti> newsArtiList;
	private List<NewsArti> naList;
	private Map<Navigation, List<NewsArti>> newsArtiMap;

	public List<NewsArti> getNewsArtiList() {
		return newsArtiList;
	}
	public void setNewsArtiList(List<NewsArti> newsArtiList) {
		this.newsArtiList = newsArtiList;
	}
	
	public List<NewsArti> getNaList() {
		return naList;
	}
	public void setNaList(List<NewsArti> naList) {
		this.naList = naList;
	}
	
	public Map<Navigation, List<NewsArti>> getNewsArtiMap() {
		return newsArtiMap;
	}
	public void setNewsArtiMap(Map<Navigation, List<NewsArti>> newsArtiMap) {
		this.newsArtiMap = newsArtiMap;
	}
	public String find_idusKnowList() throws Exception {
		
		if(this.getNav()!=null){
			this.setNav(null);
		}
		if(this.getNavList()!=null){
			this.setNavList(null);
		}
		if(this.getNewsArtiMap()!=null){
			this.setNewsArtiMap(null);
		}
		ActionContext ctx = ActionContext.getContext();
		
		String navNote = null;
		ctx.getLocale();
		if(Locale.getDefault().equals(Locale.CHINA)){
			navNote = "ik_cn";
		} else if(Locale.getDefault().equals(Locale.US)){	
			navNote = "ik_en";
		}

		Navigation nav = adminManager.findNavByNavNote(navNote);
		
		if(nav!=null){
			this.setNav(nav);
			List<Navigation> navList = adminManager.findNavListByNavPId(nav.getNavId());
			if(navList!=null){
				this.setNavList(navList);
			}
		}
		
		return "idusKnowList_find_success";
	}
	
	public String find_newsList() throws Exception{

		if(this.getNaList()!=null){
			this.setNaList(null);
		}
		if(this.getNewsArtiList()!=null){
			this.setNewsArtiList(null);
		}
		if(this.getNav()!=null){
			this.setNav(null);
		}
		if(this.getNavList()!=null){
			this.setNavList(null);
		}
		if(this.getParam_navId()!=null){
			
			int navId = Integer.parseInt(this.getParam_navId());
			Navigation nav = adminManager.findNavByNavId(navId);
			if(nav!=null){
				
				this.setNav(nav);
				List<Navigation> navList = this.cycleNavList(nav);
				
				if(navList!=null&&navList.size()>=1){
					
					List<NewsArti> naList = new ArrayList<NewsArti>();
					List<NewsArti> newsArtiList = new ArrayList<NewsArti>();
					for(int i=0;i<navList.size();i++){
						int offset = 0;
						int pageSize =1;
						List<Article> artiList = adminManager.findArtiListByNavAndPage(navList.get(i), offset, pageSize);
						if(artiList!=null&&artiList.size()>=1){
							
							
							NewsArti nai = new NewsArti();
							nai.setId(artiList.get(0).getArtiId());
							nai.setTitle(artiList.get(0).getArtiTitle());
							nai.setAddDate(artiList.get(0).getAddDate());	
							nai.setNavId(navList.get(i).getNavId());
							nai.setNavName(navList.get(i).getNavName());
							naList.add(nai);
							
							for(int j=0;j<artiList.size();j++){
								
								
								NewsArti na = new NewsArti();
								na.setId(artiList.get(j).getArtiId());
								na.setTitle(artiList.get(j).getArtiTitle());
								na.setAddDate(artiList.get(j).getAddDate());	
								na.setNavId(navList.get(i).getNavId());
								na.setNavName(navList.get(i).getNavName());

								if(newsArtiList.size()<8){
									newsArtiList.add(na);	
								}
							}
							
						}
					}

					if(newsArtiList!=null){
						this.setNewsArtiList(newsArtiList);
						newsArtiList = null;
					}
					
					if(naList!=null){
						this.setNaList(naList);
						naList = null;
					}
					
				}else{
					
					List<NewsArti> newsArtiList = new ArrayList<NewsArti>();
					int offset = 0;
					int pageSize = 1;
					List<Article> artiList = adminManager.findArtiListByNavAndPage(nav, offset, pageSize);
					if(artiList!=null&&artiList.size()>=1){
					
						for(int j=0;j<artiList.size();j++){
							
							
							NewsArti na = new NewsArti();
							na.setId(artiList.get(j).getArtiId());
							na.setTitle(artiList.get(j).getArtiTitle());
							na.setAddDate(artiList.get(j).getAddDate());	
							na.setNavId(nav.getNavId());
							na.setNavName(nav.getNavName());
							if(newsArtiList.size()<8){
								newsArtiList.add(na);	
							}
						}
						if(newsArtiList!=null){
							this.setNewsArtiList(newsArtiList);
							newsArtiList = null;
							
						}
					}
				}
			}
		}

		return "newsList_find_success";
	}

	//前台页面-------特色专科
	public String find_specOutpatient() throws Exception {
		
		if(this.getNav()!=null){
			this.setNav(null);
		}
		if(this.getNavList()!=null){
			this.setNavList(null);
		}
		String navNote=null;
		
		if(Locale.getDefault().equals(Locale.CHINA)){
			
			navNote="so_cn";
		} else if(Locale.getDefault().equals(Locale.US)){
			
			navNote="so_en";
			
		}
		Navigation nav = adminManager.findNavByNavNote(navNote);
		
		if(nav!=null){
			this.setNav(nav);
			List<Navigation> nList = adminManager.findNavListByNavPId(nav.getNavId());
			
			if(nList!=null&&nList.size()>=1){
				this.setNavList(nList);
			}	
		}
		
		return "specOutpatient_find_success";
	}
	
	public String find_soList() throws Exception{
		
		if(this.getNav()!=null){
			this.setNav(null);
		}
		if(this.getNewsArtiList()!=null){
			this.setNewsArtiList(null);
		}
		if(this.getParam_navId()!=null){
			Navigation nav = adminManager.findNavByNavId(Integer.parseInt(this.getParam_navId()));	
			if(nav!=null){
				
				List<Navigation> navList = adminManager.findNavListByNavPId(nav.getNavId());
				if(navList!=null&&navList.size()>=1){
					
					for(int i=0;i<navList.size();i++){
						List<Article> artiList = adminManager.findArtiListByNav(navList.get(i));
						List<NewsArti> nal =new ArrayList<NewsArti>();
						if(artiList!=null&&artiList.size()>=1){
							for(int j=0;j<artiList.size();j++){
								
								NewsArti na = new NewsArti();
								na.setId(artiList.get(j).getArtiId());
								na.setTitle(artiList.get(j).getArtiTitle());
								na.setAddDate(artiList.get(j).getAddDate());
								if(nal!=null&&nal.size()<8){
									nal.add(na);
								}
							}
							if(nal!=null){
								this.setNewsArtiList(nal);
								nal = null;
							}	
						}
					}
				}else{
					
					List<Article> artiList = adminManager.findArtiListByNav(nav);
					List<NewsArti> nal =new ArrayList<NewsArti>();
					if(artiList!=null&&artiList.size()>=1){
						
						for(int j=0;j<artiList.size();j++){
							
							NewsArti na = new NewsArti();
							na.setId(artiList.get(j).getArtiId());
							na.setTitle(artiList.get(j).getArtiTitle());
							na.setAddDate(artiList.get(j).getAddDate());
							if(nal!=null&&nal.size()<8){
								nal.add(na);
							}
						}
					}
					if(nal!=null){
						this.setNewsArtiList(nal);	
						nal = null;
					}
				}

			}
		}
		return "soList_find_success";
	}


	//成功案例Vo对象

	private Map<Navigation, NewsArti> navNewsArtiMap;
	
	public Map<Navigation, NewsArti> getNavNewsArtiMap() {
		return navNewsArtiMap;
	}
	public void setNavNewsArtiMap(Map<Navigation, NewsArti> navNewsArtiMap) {
		this.navNewsArtiMap = navNewsArtiMap;
	}
	
	private List<DiseArti> diseArtiList;
	private Map<Disease, List<DiseArti>> diseArtiMap;
	private List<Disease> diseaseList;
	public List<DiseArti> getDiseArtiList() {
		return diseArtiList;
	}
	
	public void setDiseArtiList(List<DiseArti> diseArtiList) {
		this.diseArtiList = diseArtiList;
	}

	public Map<Disease, List<DiseArti>> getDiseArtiMap() {
		return diseArtiMap;
	}

	public void setDiseArtiMap(Map<Disease, List<DiseArti>> diseArtiMap) {
		this.diseArtiMap = diseArtiMap;
	}

	public List<Disease> getDiseaseList() {
		return diseaseList;
	}
	public void setDiseaseList(List<Disease> diseaseList) {
		this.diseaseList = diseaseList;
	}
	
	public List<Disease> cycDiseaseList(int disPid){
		
		List<Disease> diseList = adminManager.findDisListByDisPid(disPid);
		if(diseList!=null&&diseList.size()>=1){
			
			for(int i=0;i<diseList.size();i++){

				List<Disease> dl = this.cycDiseaseList(diseList.get(i).getDiseaseId());
				if(dl!=null&&dl.size()>=1){	
					diseList.addAll(dl);	
				}
			}
			return diseList;
		}
		return null;
	}
	public String find_succCase() throws Exception {
		
		if(this.getNav()!=null){
			this.setNav(null);
		}
		if(this.getDiseaseList()!=null){
			this.setDiseaseList(null);
		}
		if(this.getDiseArtiMap()!=null){
			this.setDiseArtiMap(null);
		}
		String navNote = null;
		String langName = null;
		if(Locale.getDefault().equals(Locale.CHINA)){		
			navNote = "sc_cn";
			langName = "zh_cn";
		} else if(Locale.getDefault().equals(Locale.US)){		
			navNote = "sc_en";
			langName = "en_us";
		}

		Navigation nav = adminManager.findNavByNavNote(navNote);
		if(nav!=null){
			
			this.setNav(nav);
			
			Map<Disease, List<DiseArti>> dalMap = new LinkedHashMap<Disease, List<DiseArti>>();
			Language lang = adminManager.findLangByLangName(langName);
			List<Disease> diseList = adminManager.findDisListByDisPidAndLang(0, lang);
			if(diseList!=null&&diseList.size()>=1){

				this.setDiseaseList(diseList);
				
				List<DiseArti> dal = new ArrayList<DiseArti>();
				List<Disease> dl = new LinkedList<Disease>();
				List<Article> artiList = new LinkedList<Article>();
				for(int i=0;i<diseList.size();i++){
					dl.addAll(this.cycDiseaseList(diseList.get(i).getDiseaseId()));	
				}
				if(dl!=null&&dl.size()>=1){
					artiList = adminManager.findArtiListByDisAndNav(dl, nav);
					if(artiList!=null&&artiList.size()>=1){								
						for(int k=0;k<artiList.size();k++){
							DiseArti da = new DiseArti();
							da.setArticleId(artiList.get(k).getArtiId().intValue());
							da.setArtiTitle(artiList.get(k).getArtiTitle());
							da.setAddDate(artiList.get(k).getAddDate());
							da.setVideoImageUrl(artiList.get(k).getVideoImageUrl());
							if(da!=null&&dal.size()<7){
								dal.add(da);
							}
						}
						if(dal!=null){
							this.setDiseArtiList(dal);
							dal = null;
							
						}
					}
					dl = null;
				}
				
				for(int i=0;i<diseList.size();i++){
					
					List<Disease> dList = adminManager.findDisListByDisPid(diseList.get(i).getDiseaseId());
					List<DiseArti> datl = new ArrayList<DiseArti>();
					if(dList!=null&&dList.size()>=1){
						
						List<Article> aList = adminManager.findArtiListByDisAndNav(dList, nav);
						if(aList!=null&&aList.size()>=1){								
							for(int k=0;k<aList.size()&&k<2;k++){
								DiseArti da = new DiseArti();
								da.setArticleId(aList.get(k).getArtiId().intValue());
								
								da.setArtiTitle(aList.get(k).getArtiTitle());
								da.setAddDate(aList.get(k).getAddDate());
								da.setVideoImageUrl(aList.get(k).getVideoImageUrl());
								
								if(da!=null&&datl.size()<3){
									datl.add(da);
								}
							}
							if(datl!=null){
								dalMap.put(diseList.get(i), datl);
								datl = null;
							}else{
								dalMap.put(diseList.get(i), null);
							}
						}
					}
				}
				if(dalMap!=null&&dalMap.size()>=1){
					this.setDiseArtiMap(dalMap);
					dalMap = null;
				}
			}
		}

		return "succCase_find_success";
	}
	private String param_diseaseId;
	
	public String getParam_diseaseId() {
		return param_diseaseId;
	}

	public void setParam_diseaseId(String paramDiseaseId) {
		param_diseaseId = paramDiseaseId;
	}
	
	public String find_diseArtiList() throws Exception {
		
		
		if(this.getParam_diseaseId()!=null){
			
			if(this.getNav()!=null){
				this.setNav(null);
			}
			String navNote = null;
			
			if(Locale.getDefault().equals(Locale.CHINA)){
				
				navNote = "sc_cn";
				
			} else if(Locale.getDefault().equals(Locale.US)){
				
				navNote = "sc_en";
				
			}
			Navigation nav = adminManager.findNavByNavNote(navNote);
			int disId = Integer.parseInt(this.getParam_diseaseId());
			Disease disease = adminManager.findDisByDisId(disId);
			List<Disease> dList = adminManager.findDisListByDisPid(disease.getDiseaseId());
			List<DiseArti> datList = new ArrayList<DiseArti>();
			if(dList!=null&&dList.size()>=1){
				
				List<Article> aList = adminManager.findArtiListByDisAndNav(dList, nav);
				if(aList!=null&&aList.size()>=1){								
					for(int k=0;k<aList.size()&&k<2;k++){
						DiseArti da = new DiseArti();
						da.setArticleId(aList.get(k).getArtiId().intValue());
						da.setArtiTitle(aList.get(k).getArtiTitle());
						da.setAddDate(aList.get(k).getAddDate());
						da.setVideoImageUrl(aList.get(k).getVideoImageUrl());
						if(da!=null&&datList.size()<5){
							datList.add(da);
						}
					}
					
				}
			}
			if(datList!=null&&datList.size()>=1){
				this.setDiseArtiList(datList);
				datList = null;
			}
			
			this.setParam_diseaseId(null);
		}
		return "diseArtiList_find_success";
	}
	
	
	
	
	/**
	 * -----------------前台--------友情链接(修改)
	 */
	
	

	private List<FriendLink> friendLinkList;
	public List<FriendLink> getFriendLinkList() {
		return friendLinkList;
	}
	public void setFriendLinkList(List<FriendLink> friendLinkList) {
		this.friendLinkList = friendLinkList;
	}

	public String find_linkList() throws Exception {
		
		if(this.getNav()!=null){
			this.setNav(null);
		}
		if(this.getFriendLinkList()!=null){
			this.setFriendLinkList(null);
		}
		String navNote=null;
		if(Locale.getDefault().equals(Locale.CHINA)){
		
			navNote = "fl_cn";
			
		}else if(Locale.getDefault().equals(Locale.US)){

			navNote = "fl_en";
		}
		Navigation nav = adminManager.findNavByNavNote(navNote);
		if(nav!=null){
			
			this.setNav(nav);
			
			List<Article> artiList = adminManager.findArtiListByNav(nav);
			if(artiList!=null&&artiList.size()>=1){
				
				List<FriendLink> flList = new ArrayList<FriendLink>();
				for(int i=0;i<artiList.size();i++){
					
					Article arti = artiList.get(i);
					FriendLink fl = new FriendLink();
					if(arti!=null){
						
						fl.setId(arti.getArtiId());
						fl.setTitle(arti.getArtiTitle());
						fl.setUrl(arti.getUrl());
						List<Image> imageList = adminManager.findImageByArti(arti);
						if(imageList!=null&&imageList.size()>=1){
							Image image = imageList.get(0);
							fl.setImageSrc(image.getImgSrcName()+image.getImgSaveName());
						}
						flList.add(fl);
					}	
				}
				if(flList!=null){			
					this.setFriendLinkList(flList);
					flList = null;
				}			
			}
		}

		return "linkList_find_success";
	}
	
	//留言信息管理

	private MessageVo messageVo;
	
	public MessageVo getMessageVo() {
		return messageVo;
	}
	public void setMessageVo(MessageVo messageVo) {
		this.messageVo = messageVo;
	}
	public String insert_message() throws Exception{
		
		if(this.getNav()!=null){
			this.setNav(null);
		}
		String navNote = null;

		if(Locale.getDefault().equals(Locale.CHINA)){
			navNote = "m_cn";
		} else if(Locale.getDefault().equals(Locale.US)){
			
			navNote = "m_en";
		}
		if(navNote!=null){
			
			Navigation nav = adminManager.findNavByNavNote(navNote);
			
			if(nav!=null){
				this.setNav(nav);
			}
			
		}
		
		return "message_insert_success";
	}
	public String add_message() throws Exception{
		
		if(this.getNav()!=null){
			this.setNav(null);
		}
		Message m = new Message();
		
		if(this.getMessageVo()!=null){
			
			m.setName(this.getMessageVo().getName());
			m.setTitle(this.getMessageVo().getTitle());
			m.setPhone(this.getMessageVo().getPhone());
			m.setReplyFlag(false);
			m.setContent(this.getMessageVo().getContent());
			m.setEmail(this.getMessageVo().getEmail());
			Timestamp addDate = DateTimeUtil.getNowTime();
			m.setAddDate(addDate);
			if(m!=null){
				adminManager.add_message(m);
			}
			this.setMessageVo(null);
			
		}

		return "message_add_success";
	}

}
